import React,{Component} from "react";
import {connect} from "react-redux";
import {
    View,
    Text,
    Button,
    StyleSheet
} from "react-native";

class IndexD extends Component {
    static navigationOptions = {
        title:"个人中心"
    };

    constructor(props){
        super(props);

    }

    render(){
        console.log("indexD screen this.props:",this.props);
        const {navigate} = this.props.navigation;
        return (
            <View style={{flex:1,justifyContent:"center",alignItems:"center"}}>

                <Text style={{fontSize:20,textAlign:"center",color:"red"}}>
                    IndexD 当前登录状态：{this.props.isLoggedIn ? "已经登录" : '未登录'}
                </Text>
                <Button title="去登陆" onPress={()=>navigate("LoginActivity",{paramKey:"paramValue"})} />
            </View>
        )
    }

    dologin(){
        const {navigate} = this.props.navigation;
        console.log("正在去登录");
    };

}

mapStateToProps = (state)=>{
    return {
        isLoggedIn:state.userStore.isLoggedIn
    }
};

export default  connect(mapStateToProps)(IndexD);

